@layout("/common/_vContainer.html"){
<div id="app">
    <el-row :gutter="20">
        <el-col :span="6">
            <div class="card">
                <div class="p-tb-10 f-w-700">年级管理</div>
            </div>
        </el-col>
        <el-col :span="18">
            <div class="card">
                @if(shiro.hasPermission("/term/add")){
                <el-button type="primary" v-on:click="modal.add = true"><i class="el-icon-circle-plus"></i> 添加</el-button>
                @}
            </div>
        </el-col>
    </el-row>
    <div class="card">
        <el-row>
            <el-form :model="condition" :inline="true">
                <el-form-item label="关键字">
                    <el-input placeholder="关键字搜索" v-model="condition.key"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" v-on:click="query">查询</el-button>
                </el-form-item>
            </el-form>
        </el-row>
        <el-table :data="page.data" highlight-current-row style="width: 100%">
            <el-table-column type="index" width="45"></el-table-column>
            <el-table-column property="id" label="ID"></el-table-column>
            <el-table-column property="name" label="名称"></el-table-column>
            <el-table-column property="code" label="编码"></el-table-column>
            <el-table-column property="remark" label="备注"></el-table-column>
            <el-table-column label="操作">
                <template slot-scope="scope">
                    @if(shiro.hasPermission("/term/update")){
                    <el-button type="info" size="mini" v-on:click="toUpdate(scope.row)">编辑</el-button>
                    @}
                    @if(shiro.hasPermission("/term/delete")){
                    <el-button type="danger" size="mini" v-on:click="doDelete(scope.row.id)">删除</el-button>
                    @}
                </template>
            </el-table-column>
        </el-table>
    </div>

    <!--modal 4 add-->
    <el-dialog :visible.sync="modal.add" title="添加" width="50%" :modal-append-to-body="false">
        <div>
            <el-form :model="form.aModel" :rules="form.rules" label-width="110px" ref="addForm">
                <el-form-item label="名称" prop="name">
                    <el-input v-model="form.aModel.name" placeholder="名称"></el-input>
                </el-form-item>
                <el-form-item label="编码" prop="code">
                    <el-input v-model="form.aModel.code" placeholder="编码"></el-input>
                </el-form-item>
                <el-form-item label="备注" prop="remark">
                    <el-input v-model="form.aModel.remark" placeholder="备注"></el-input>
                </el-form-item>
            </el-form>
        </div>
        <div slot="footer" class="text-right">
            <el-button v-on:click="modal.add = false">取 消</el-button>
            <el-button type="primary" v-on:click="doAdd">确定添加</el-button>
        </div>
    </el-dialog>

    <!--modal 4 edit-->
    <el-dialog :visible.sync="modal.update" title="编辑" width="50%" :modal-append-to-body="false">
        <div>
            <el-form :model="form.eModel" :rules="form.rules" label-width="110px"  ref="updateForm">
                <el-form-item label="名称" prop="name">
                    <el-input v-model="form.eModel.name" placeholder="名称"></el-input>
                </el-form-item>
                <el-form-item label="编码" prop="code">
                    <el-input v-model="form.eModel.code" placeholder="编码"></el-input>
                </el-form-item>
                <el-form-item label="备注" prop="remark">
                    <el-input v-model="form.eModel.remark" placeholder="备注"></el-input>
                </el-form-item>
            </el-form>
        </div>
        <div slot="footer" class="text-right">
            <el-button v-on:click="modal.update = false">取 消</el-button>
            <el-button type="primary" v-on:click="doUpdate">保存编辑</el-button>
        </div>
    </el-dialog>
</div>
<script src="${ctxPath}/static/modular/edu/term/term.js"></script>
@}
